home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_shs_treasuregate.cog < prev    next >
Text File  |  1999-11-15  |  5KB  |  228 lines

  1. # Jones 3D Cog Script
  2. #
  3. # SHS_TreasureGate.cog      Closes gate on Indy. Commies show up. (ha ha)
  4. #
  5. # [JWC]
  6. #
  7. # (C) 1998 LucasArts Entertainment Company LLC. All Rights Reserved
  8. #
  9. # ========================================================================================
  10.    
  11. symbols
  12.  
  13. message     entered
  14. message     activated
  15. message     startup
  16. message        taken
  17.  
  18.  
  19. keyframe    inReach=in_activate_medium.key      local
  20.  
  21.  
  22. sector      tripsector
  23.  
  24. sound        unlock=tem_monkeykey_unlock_c.wav     local
  25. sound       in_whoa=inxj007.wav                   local
  26. sound        music0=mus_gen_russbold_shrt4.wav    local
  27. sound        music1=mus_gen_indyrelief.wav        local     
  28. sound        comchat=Inxh1007.wav                local
  29.  
  30. surface        blocked
  31.  
  32. template    tpl_indy=indy_actor                    local    
  33.  
  34. thing        indyactor       local
  35. thing        gate                         
  36. thing        player            local
  37. thing       lock
  38. thing        keyCam
  39. thing        bulb
  40. thing        key
  41. thing        looktarg
  42.  
  43. thing       commie0
  44. thing       commie1
  45.  
  46. int         closed=0          local
  47. int         speed=20          local
  48. int            bronzeKey=103    local
  49. int            whichItem        local
  50. int            keygrumble=0    local
  51. int            keyed=0            local
  52. int         x                local
  53. int         in_rotRate        local
  54.  
  55. cog            doortalkcog
  56.  
  57. end 
  58.  
  59. # ========================================================================================
  60.  
  61. code
  62.  
  63. startup:
  64.  
  65.     player = GetLocalPlayerThing();
  66.     SetThingFlags(key, 0x80000);
  67.     SetAdjoinFlags(blocked, 0x10);
  68.     for (x=0; x<=2; x=x+1)
  69.     {
  70.         SetThingFlags(commie0[x], 0x80000); #make invisible
  71.         AISetCutsceneMode(commie0[x]);
  72.     }
  73.     return;
  74.     
  75. entered:
  76.  
  77.     if (closed < 1)
  78.     {                 
  79.         # Gate closes if indy walks into sector
  80.         MoveToFrame(gate, 1, speed);
  81.         WaitForStop(gate);
  82.         PlayVoice(player, in_whoa, 1.0, 0);
  83.         closed = 1;
  84.     }
  85.     return;
  86.  
  87. activated:
  88.   
  89.     if (GetSenderRef() == lock)
  90.     {    
  91.         if (keyed==1) return; 
  92.         
  93.         # check if inventory is being used...
  94.         whichItem = GetCurItem(player);
  95.         
  96.         # Prep for scene...
  97.         SetActorFlags(player, 0x200000);
  98.         StartCutScene(1);
  99.         StopThing(player);
  100.         DeselectWeaponWait(player);
  101.         Sleep(0.5); # wait a beat
  102.         
  103.         # Slew follow camera to observe the scene from a known position
  104.         SetExtCamOffsetToThing(keyCam);
  105.         
  106.         # Swap player for actor
  107.         indyactor = CreateThing(tpl_Indy, player);
  108.         CaptureThing(indyactor);
  109.         CopyPlayerHolsters(player, indyactor);
  110.         ClearThingFlags(indyactor, 0x80000);
  111.         SetThingFlags(player, 0x80000);
  112.  
  113.         Sleep(0.5);
  114.     
  115.         # Look at keyhole, Indy
  116.         AiSetLookThing(indyactor, lock);
  117.         
  118.         if ((whichItem == bronzeKey) && (keyed ==0))
  119.         {
  120.                         
  121.             PlayKey(indyactor, inReach, 4, 0x12, 0);
  122.             
  123.             ChangeInv(player, bronzeKey, -1);
  124.             Sleep(0.2);
  125.             ClearThingFlags(key, 0x80000);
  126.  
  127.             # play sound of key opening
  128.             PlaySoundLocal(unlock, 1.0, 0.0, 0x0, 1);
  129.             
  130.             # Indy notes success
  131.             SendMessageEx(doortalkcog, user1, indyactor, 1, 1, 0);
  132.             while (global15 == 0)
  133.             {
  134.                 Sleep(0.01); # wait for line to finish
  135.             }
  136.             
  137.             # open gate
  138.             ClearAdjoinFlags(blocked, 0x10);
  139.             PlaySoundLocal(music1, 1.0, 0.0, 0x0, 0);
  140.             MoveToFrame(gate, 0, 1.0);
  141.             
  142.             # looks at gate
  143.             in_rotRate = GetThingMaxRotVel(player);     # remember Indy rate
  144.             SetThingMaxRotVel(indyactor, 75.0);
  145.             AISetLookThing(indyactor, looktarg);
  146.             
  147.             WaitForStop(gate);
  148.             keyed=1; # plays only once
  149.         
  150.         }
  151.         else
  152.         {                                
  153.             if (whichItem != 0)
  154.             {
  155.                 # Take care of wrong keys and items...
  156.                 PlayKey(indyactor, inReach, 4, 0x12, 0);
  157.                 Sleep(0.2);
  158.                 SendMessageEx(doortalkcog, user0, indyactor, bronzeKey, whichItem, 0);
  159.             }
  160.             else
  161.             {
  162.                 if (keygrumble == 0)
  163.                 {
  164.                     # Note need for key 1st time thru...
  165.                     SendMessageEx(doortalkcog, user4, indyactor, 1, 3, 0);
  166.                     keygrumble = 1;
  167.                 }
  168.                 else
  169.                 {
  170.                     # General "door is locked" grmubling thereafter...
  171.                     SendMessageEx(doortalkcog, user4, indyactor, 0, 0, 0);
  172.                 }
  173.             
  174.             }
  175.             
  176.             while (global15 == 0)
  177.             {
  178.                 Sleep(0.01); # wait for line to finish
  179.             }
  180.             
  181.             Sleep(0.3);
  182.             
  183.             
  184.         }
  185.         # swap player back
  186.         SetThingMaxRotVel(indyactor, in_rotRate);
  187.         ClearThingFlags(player, 0x80000);
  188.         TeleportThing(player, indyactor);
  189.         DestroyThing(indyactor);
  190.  
  191.         # return control
  192.         RestoreExtCam();
  193.         ClearActorFlags(player, 0x200000);
  194.         EndCutScene();
  195.         return; 
  196.     
  197.     
  198.     }
  199.     return;    
  200.         
  201. taken:
  202.     
  203.     if (GetSenderRef() == bulb)
  204.     {
  205.         print("bulb taken, commies should be here");
  206.         # make commies visible
  207.         for (x=0; x<=2; x=x+1)
  208.         {
  209.             ClearThingFlags(commie0[x], 0x80000); # make visible
  210.         }
  211.         Sleep(2.5);     # Let Indy finish talking and get ready
  212.         
  213.         # play russian music
  214.         PlaySoundLocal(music0, 1.0, 0.0, 0x0, 0);
  215.         PlaySoundLocal(comchat, .5, 0, 0x0, 0);
  216.         
  217.         for (x=0; x<=2; x=x+1)
  218.         {
  219.             AIClearCutsceneMode(commie0[x]);     # wake them up
  220.         }
  221.  
  222.     }
  223. return;
  224.  
  225.  
  226. end
  227.  
  228.